package com.sky.mapper;

import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {

    /**
     * 批量查找数据
     * @param ids
     * @return
     */
    public List<Long> queryDishId(List<Long> ids);

    /**
     * 批量存储套餐与菜品关系
     * @param setmealDishes
     */
    void saveSetmealDishes(List<SetmealDish> setmealDishes);

    /**
     * 根据套餐与菜品关系表获取套餐id
     * @param id
     * @return
     */
    @Select("select setmeal_id from setmeal_dish where dish_id=#{id}")
    Long getId(Long id);

    /**
     * 根据id删除菜品
     * @param id
     */
    @Delete("delete from setmeal_dish where setmeal_id=#{id}")
    void deleteByid(Long id);

    /**
     * 根据套餐id查找关联数据
     * @param id
     * @return
     */
    @Select("select * from setmeal_dish where setmeal_id=#{id}")
    List<SetmealDish> getSetmealList(Long id);

    /**
     * 根据id批量删除
     * @param ids
     */
    void deleteByIds(List<Long> ids);
}
